package com.wxzz.elearing.user.api.admin;

import com.wxzz.elearing.user.dto.HelpCenterDto;
import com.wxzz.elearing.user.dto.PlatformParamDto;
import com.wxzz.elearing.user.dto.PlatformParamSelDto;
import com.wxzz.elearing.user.entity.HelpCenter;
import com.wxzz.elearing.user.entity.PlatformParam;
import com.wxzz.elearing.user.service.IPlatformParamService;
import com.wxzz.elearning.common.vo.JgPageVo;
import com.wxzz.elearning.common.vo.ReturnVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/platform-param")
@Api(tags = "平台参数(后台)")
public class PlatformParamController {

    @Autowired
    private IPlatformParamService platformParamService;

    @ApiOperation(value = "根据类型查询平台参数", notes = "根据类型查询平台参数", httpMethod = "POST", tags = "后台")
    @RequestMapping(value = "listPlatformParam", method = RequestMethod.POST)
    public ReturnVO listPlatformParam(@RequestHeader String token, @RequestBody PlatformParamDto platformParamDto) {
        return platformParamService.listPlatformParam(platformParamDto);
    }

    @ApiOperation(value = "修改平台参数", notes = "修改平台参数", httpMethod = "POST", tags = "后台")
    @RequestMapping(value = "updatePlatformParam", method = RequestMethod.POST)
    public ReturnVO updatePlatformParam(@RequestHeader String token, @RequestBody PlatformParam platformParam) {
        return platformParamService.updatePlatformParam(platformParam);
    }

    @ApiOperation(value = "动态修改平台参数", notes = "动态修改平台参数", httpMethod = "POST", tags = "后台")
    @RequestMapping(value = "updatePlatformParamUnList", method = RequestMethod.POST)
    public ReturnVO updatePlatformParamUnList(@RequestHeader String token, @RequestBody Map<String, String> map) {
        return platformParamService.updatePlatformParamUnList(map);
    }

    @ApiOperation(value = "查询平台参数", notes = "查询平台参数", httpMethod = "POST", tags = "后台")
    @RequestMapping(value = "selectOnePlatformParam", method = RequestMethod.POST)
    public ReturnVO<PlatformParam> selectOnePlatformParam(@RequestHeader String token, @RequestBody PlatformParamSelDto platformParamSelDto) {
        return platformParamService.selectOnePlatformParam(platformParamSelDto);
    }

    @ApiOperation(value = "列出帮助中心", notes = "列出帮助中心", httpMethod = "POST", tags = "后台")
    @RequestMapping(value = "listHelpCenter", method = RequestMethod.POST)
    public ReturnVO<JgPageVo<List<HelpCenter>>> listHelpCenter(@RequestHeader String token, @RequestBody HelpCenterDto helpCenterDto) {
        return platformParamService.listHelpCenter(helpCenterDto);
    }

    @ApiOperation(value = "新增或修改帮助中心", notes = "新增或修改帮助中心", httpMethod = "POST", tags = "后台")
    @RequestMapping(value = "saveHelpCenter", method = RequestMethod.POST)
    public ReturnVO saveHelpCenter(@RequestHeader String token, @RequestBody HelpCenter helpCenter) {
        return platformParamService.saveHelpCenter(helpCenter);
    }

    @ApiOperation(value = "删除帮助中心", notes = "删除帮助中心", httpMethod = "POST", tags = "后台")
    @RequestMapping(value = "deleteHelpCenter/{helpCenterId}", method = RequestMethod.POST)
    public ReturnVO deleteHelpCenter(@PathVariable Long helpCenterId) {
        return platformParamService.deleteHelpCenter(helpCenterId);
    }





//    @ApiOperation(value = "新增或修改帮助中心", notes = "新增或修改帮助中心", httpMethod = "POST", tags = "后台")
//    @RequestMapping(value = "saveHelpCenter", method = RequestMethod.POST)
//    public ReturnVO saveHelpCenter(@RequestHeader String token, @RequestBody HelpCenter helpCenter) {
//        return platformParamService.saveHelpCenter(helpCenter);
//    }

}
